package main

import "fmt"

func main() {
	var (
		ch   = make(chan int)
		quit = make(chan bool)
	)

	go func() {
		for i := 0; i < 10; i++ {
			ch <- i
		}
		quit <- true
		close(ch)
	}()

	for {
		select {
		case num := <-ch:
			fmt.Println("读到:", num)
		case <-quit:
			//break  //break只是跳出select
			return
		}
		fmt.Println("=========")
	}
}
